package com.lwy.qiuchao.field.service.impl;

import com.lwy.qiuchao.field.dao.FieldDao;
import com.lwy.qiuchao.field.entity.FieldEntity;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lwy.common.utils.PageUtils;
import com.lwy.common.utils.Query;

import com.lwy.qiuchao.field.dao.CityDao;
import com.lwy.qiuchao.field.entity.CityEntity;
import com.lwy.qiuchao.field.service.CityService;


@Service("cityService")
public class CityServiceImpl extends ServiceImpl<CityDao, CityEntity> implements CityService {

    @Autowired
    FieldDao fieldDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CityEntity> page = this.page(
                new Query<CityEntity>().getPage(params),
                new QueryWrapper<CityEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public void addCity(CityEntity cityEntity) {
        this.baseMapper.insert(cityEntity);
    }

    @Override
    public List<FieldEntity> QueryFieldCount(Long cityId) {
        List<FieldEntity> fieldEntities = fieldDao.selectList(null);
        return fieldEntities;
    }


}